package com.wgod.demo.business.mapper;

import com.wgod.demo.business.model.cond.CommentCond;
import tk.mybatis.mapper.common.Mapper;
import org.apache.ibatis.annotations.Param;

import com.wgod.demo.business.entity.CommentEntity;

import java.util.List;

/**
 * 评论实体类
 * Created by WGod on 2018/4/29.
 */
public interface CommentMapper extends Mapper<CommentEntity> {

    /**
     * 新增评论
     * @param commentEntity
     * @return
     */
    int addComment(CommentEntity commentEntity);

    /**
     * 删除评论
     * @param coid
     * @return
     */
    int deleteComment(@Param("coid") Integer coid);

    /**
     * 更新评论的状态
     * @param coid
     * @return
     */
    int updateCommentStatus(@Param("coid") Integer coid, @Param("status") String status);

    /**
     * 获取单条评论
     * @param coid
     * @return
     */
    CommentEntity getCommentById(@Param("coid") Integer coid);
    /**
     * 根据文章编号获取评论列表
     * @param cid
     * @return
     */
    List<CommentEntity> getCommentsByCId(@Param("cid") Integer cid);

    /**
     * 根据条件获取评论列表
     * @param commentCond
     * @return
     */
    List<CommentEntity> getCommentsByCond(CommentCond commentCond);

    /**
     * 获取文章数量
     * @return
     */
    Long getCommentsCount();
}
